package com.jinlingxiu.app.mvp.presenter

import com.blankj.utilcode.util.TimeUtils
import com.jinlingxiu.app.mvp.contract.PermissionContract
import com.xdja.easymvp.mvp.BasePresenter
import kotlinx.coroutines.delay
import java.util.*

/**
 * 描述:
 * Create by yuanwanli
 * Date 2020/09/14
 */
class PermissionPresenter(model: PermissionContract.Model, rootView: PermissionContract.View) :
    BasePresenter<PermissionContract.Model, PermissionContract.View>(model, rootView) {
    fun getDelay() {
        launch {
            val instance = Calendar.getInstance()
            instance.set(2020, 9, 1)
            val oneTime = 1601481600000
            val nowMills = TimeUtils.getNowMills()
            if (nowMills >= oneTime) {
                mRootView?.showTips()
            } else {
                repeat(1) {
                    delay(500L)
                    mRootView?.startNext()
                }
            }
        }
    }

}
